import { queryCategory } from '../services/api';

export default {
  namespace: 'order',

  state: {
    list: [],
    loadding:false
  },
  effects: {
    *fetchCategory(_, { call, put }) {
      const response = yield call(queryCategory);
      yield put({
        type: 'queryList',
        payload: response.list,
      });
    },
  },

  reducers: {
    queryList(state, action) {
      return {
        ...state,
        list: state.list.concat(action.payload),
      };
    },
  },
};
